package com.health.test;
 import   javax.swing.*;
 import   java.awt.*; 
 import   java.awt.event.*; 
 public   class   DragWindow   extends   JWindow{ 
     int   positionX; 
     int   positionY; 
     public   DragWindow()   { 
         try   { 
             jbInit(); 
         } 
         catch(Exception   e)   { 
             e.printStackTrace(); 
         } 
     } 
     private   void   jbInit()   throws   Exception   { 
         this.addMouseListener(new   java.awt.event.MouseAdapter()   { 
             public   void   mousePressed(MouseEvent   e)   { 
                 this_mousePressed(e); 
             } 
         }); 
         this.addMouseMotionListener(new   java.awt.event.MouseMotionAdapter()   { 
             public   void   mouseDragged(MouseEvent   e)   { 
                 this_mouseDragged(e); 
             } 
         }); 
     } 
 
     void   this_mouseDragged(MouseEvent   e)   { 
                 Point   point   =   this.getLocation(); 
                 this.setLocation(point.x   +   e.getX()   -   positionX,point.y   +   e.getY()   -   positionY); 
     } 
 
     void   this_mousePressed(MouseEvent   e)   { 
                 positionX   =   e.getX(); 
                 positionY   =   e.getY(); 
     } 
 
     /** 
       * 
       */ 
       public   static   void   main(String[]   args)   { 
         DragWindow   test   =   new   DragWindow(); 
         test.setPreferredSize(new Dimension(3000, 30));
         test.pack();
         test.setVisible(true);
   		 test.setAlwaysOnTop(true);
       	} 
       public void paint(Graphics g) {
           g.setColor(new Color(0, 0, 0));
           g.fillRect(0, 0, getSize().width, getSize().height);
       }
            
 } 